home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 98 / Skunkware 98.iso / src / interp / perl-5.003.tar.gz / perl-5.003.tar / perl-5.003 / perly.c.diff < prev    next >
Text File  |  1996-02-14  |  11KB  |  424 lines

  1. *** perly.c.orig    Wed Feb 14 15:29:04 1996
  2. --- perly.c    Wed Feb 14 15:29:05 1996
  3. ***************
  4. *** 12,82 ****
  5.       deprecate("\"do\" to call subroutines");
  6.   }
  7.   
  8. - #line 29 "perly.y"
  9. - typedef union {
  10. -     I32    ival;
  11. -     char *pval;
  12. -     OP *opval;
  13. -     GV *gvval;
  14. - } YYSTYPE;
  15. - #line 23 "y.tab.c"
  16. - #define WORD 257
  17. - #define METHOD 258
  18. - #define FUNCMETH 259
  19. - #define THING 260
  20. - #define PMFUNC 261
  21. - #define PRIVATEREF 262
  22. - #define FUNC0SUB 263
  23. - #define UNIOPSUB 264
  24. - #define LSTOPSUB 265
  25. - #define LABEL 266
  26. - #define FORMAT 267
  27. - #define SUB 268
  28. - #define ANONSUB 269
  29. - #define PACKAGE 270
  30. - #define USE 271
  31. - #define WHILE 272
  32. - #define UNTIL 273
  33. - #define IF 274
  34. - #define UNLESS 275
  35. - #define ELSE 276
  36. - #define ELSIF 277
  37. - #define CONTINUE 278
  38. - #define FOR 279
  39. - #define LOOPEX 280
  40. - #define DOTDOT 281
  41. - #define FUNC0 282
  42. - #define FUNC1 283
  43. - #define FUNC 284
  44. - #define RELOP 285
  45. - #define EQOP 286
  46. - #define MULOP 287
  47. - #define ADDOP 288
  48. - #define DOLSHARP 289
  49. - #define DO 290
  50. - #define LOCAL 291
  51. - #define HASHBRACK 292
  52. - #define NOAMP 293
  53. - #define OROP 294
  54. - #define ANDOP 295
  55. - #define NOTOP 296
  56. - #define LSTOP 297
  57. - #define ASSIGNOP 298
  58. - #define OROR 299
  59. - #define ANDAND 300
  60. - #define BITOROP 301
  61. - #define BITANDOP 302
  62. - #define UNIOP 303
  63. - #define SHIFTOP 304
  64. - #define MATCHOP 305
  65. - #define UMINUS 306
  66. - #define REFGEN 307
  67. - #define POWOP 308
  68. - #define PREINC 309
  69. - #define PREDEC 310
  70. - #define POSTINC 311
  71. - #define POSTDEC 312
  72. - #define ARROW 313
  73.   #define YYERRCODE 256
  74.   short yylhs[] = {                                        -1,
  75.      31,    0,    5,    3,    6,    6,    6,    7,    7,    7,
  76. --- 12,17 ----
  77. ***************
  78. *** 1381,1393 ****
  79.   int yynerrs;
  80.   int yyerrflag;
  81.   int yychar;
  82. - short *yyssp;
  83. - YYSTYPE *yyvsp;
  84.   YYSTYPE yyval;
  85.   YYSTYPE yylval;
  86. - short yyss[YYSTACKSIZE];
  87. - YYSTYPE yyvs[YYSTACKSIZE];
  88. - #define yystacksize YYSTACKSIZE
  89.   #line 571 "perly.y"
  90.    /* PROGRAM */
  91.   #line 1394 "y.tab.c"
  92. --- 1316,1323 ----
  93. ***************
  94. *** 1394,1407 ****
  95. --- 1324,1382 ----
  96.   #define YYABORT goto yyabort
  97.   #define YYACCEPT goto yyaccept
  98.   #define YYERROR goto yyerrlab
  99. + struct ysv {
  100. +     short* yyss;
  101. +     YYSTYPE* yyvs;
  102. +     int oldyydebug;
  103. +     int oldyynerrs;
  104. +     int oldyyerrflag;
  105. +     int oldyychar;
  106. +     YYSTYPE oldyyval;
  107. +     YYSTYPE oldyylval;
  108. + };
  109. + void
  110. + yydestruct(ptr)
  111. + void* ptr;
  112. + {
  113. +     struct ysv* ysave = (struct ysv*)ptr;
  114. +     if (ysave->yyss) Safefree(ysave->yyss);
  115. +     if (ysave->yyvs) Safefree(ysave->yyvs);
  116. +     yydebug    = ysave->oldyydebug;
  117. +     yynerrs    = ysave->oldyynerrs;
  118. +     yyerrflag    = ysave->oldyyerrflag;
  119. +     yychar    = ysave->oldyychar;
  120. +     yyval    = ysave->oldyyval;
  121. +     yylval    = ysave->oldyylval;
  122. +     Safefree(ysave);
  123. + }
  124.   int
  125.   yyparse()
  126.   {
  127.       register int yym, yyn, yystate;
  128. +     register short *yyssp;
  129. +     register YYSTYPE *yyvsp;
  130. +     short* yyss;
  131. +     YYSTYPE* yyvs;
  132. +     unsigned yystacksize = YYSTACKSIZE;
  133. +     int retval = 0;
  134.   #if YYDEBUG
  135.       register char *yys;
  136.       extern char *getenv();
  137. + #endif
  138.   
  139. +     struct ysv *ysave = (struct ysv*)safemalloc(sizeof(struct ysv));
  140. +     SAVEDESTRUCTOR(yydestruct, ysave);
  141. +     ysave->oldyydebug    = yydebug;
  142. +     ysave->oldyynerrs    = yynerrs;
  143. +     ysave->oldyyerrflag    = yyerrflag;
  144. +     ysave->oldyychar    = yychar;
  145. +     ysave->oldyyval    = yyval;
  146. +     ysave->oldyylval    = yylval;
  147. + #if YYDEBUG
  148.       if (yys = getenv("YYDEBUG"))
  149.       {
  150.           yyn = *yys;
  151. ***************
  152. *** 1414,1419 ****
  153. --- 1389,1402 ----
  154.       yyerrflag = 0;
  155.       yychar = (-1);
  156.   
  157. +     /*
  158. +     ** Initialize private stacks (yyparse may be called from an action)
  159. +     */
  160. +     ysave->yyss = yyss = (short*)safemalloc(yystacksize*sizeof(short));
  161. +     ysave->yyvs = yyvs = (YYSTYPE*)safemalloc(yystacksize*sizeof(YYSTYPE));
  162. +     if (!yyvs || !yyss)
  163. +     goto yyoverflow;
  164.       yyssp = yyss;
  165.       yyvsp = yyvs;
  166.       *yyssp = yystate = 0;
  167. ***************
  168. *** 1429,1435 ****
  169.               yys = 0;
  170.               if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
  171.               if (!yys) yys = "illegal-symbol";
  172. !             printf("yydebug: state %d, reading %d (%s)\n", yystate,
  173.                       yychar, yys);
  174.           }
  175.   #endif
  176. --- 1412,1418 ----
  177.               yys = 0;
  178.               if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
  179.               if (!yys) yys = "illegal-symbol";
  180. !             fprintf(stderr, "yydebug: state %d, reading %d (%s)\n", yystate,
  181.                       yychar, yys);
  182.           }
  183.   #endif
  184. ***************
  185. *** 1439,1450 ****
  186.       {
  187.   #if YYDEBUG
  188.           if (yydebug)
  189. !             printf("yydebug: state %d, shifting to state %d\n",
  190.                       yystate, yytable[yyn]);
  191.   #endif
  192.           if (yyssp >= yyss + yystacksize - 1)
  193.           {
  194. !             goto yyoverflow;
  195.           }
  196.           *++yyssp = yystate = yytable[yyn];
  197.           *++yyvsp = yylval;
  198. --- 1422,1447 ----
  199.       {
  200.   #if YYDEBUG
  201.           if (yydebug)
  202. !             fprintf(stderr, "yydebug: state %d, shifting to state %d\n",
  203.                       yystate, yytable[yyn]);
  204.   #endif
  205.           if (yyssp >= yyss + yystacksize - 1)
  206.           {
  207. !         /*
  208. !         ** reallocate and recover.  Note that pointers
  209. !         ** have to be reset, or bad things will happen
  210. !         */
  211. !         int yyps_index = (yyssp - yyss);
  212. !         int yypv_index = (yyvsp - yyvs);
  213. !         yystacksize += YYSTACKSIZE;
  214. !         ysave->yyvs = yyvs =
  215. !         (YYSTYPE*)realloc((char*)yyvs,yystacksize * sizeof(YYSTYPE));
  216. !         ysave->yyss = yyss =
  217. !         (short*)realloc((char*)yyss,yystacksize * sizeof(short));
  218. !         if (!yyvs || !yyss)
  219. !         goto yyoverflow;
  220. !         yyssp = yyss + yyps_index;
  221. !         yyvsp = yyvs + yypv_index;
  222.           }
  223.           *++yyssp = yystate = yytable[yyn];
  224.           *++yyvsp = yylval;
  225. ***************
  226. *** 1480,1491 ****
  227.               {
  228.   #if YYDEBUG
  229.                   if (yydebug)
  230. !                     printf("yydebug: state %d, error recovery shifting\
  231. !  to state %d\n", *yyssp, yytable[yyn]);
  232.   #endif
  233.                   if (yyssp >= yyss + yystacksize - 1)
  234.                   {
  235. !                     goto yyoverflow;
  236.                   }
  237.                   *++yyssp = yystate = yytable[yyn];
  238.                   *++yyvsp = yylval;
  239. --- 1477,1503 ----
  240.               {
  241.   #if YYDEBUG
  242.                   if (yydebug)
  243. !                     fprintf(stderr,
  244. !              "yydebug: state %d, error recovery shifting to state %d\n",
  245. !              *yyssp, yytable[yyn]);
  246.   #endif
  247.                   if (yyssp >= yyss + yystacksize - 1)
  248.                   {
  249. !             /*
  250. !             ** reallocate and recover.  Note that pointers
  251. !             ** have to be reset, or bad things will happen
  252. !             */
  253. !             int yyps_index = (yyssp - yyss);
  254. !             int yypv_index = (yyvsp - yyvs);
  255. !             yystacksize += YYSTACKSIZE;
  256. !             ysave->yyvs = yyvs = (YYSTYPE*)realloc((char*)yyvs,
  257. !             yystacksize * sizeof(YYSTYPE));
  258. !             ysave->yyss = yyss = (short*)realloc((char*)yyss,
  259. !             yystacksize * sizeof(short));
  260. !             if (!yyvs || !yyss)
  261. !             goto yyoverflow;
  262. !             yyssp = yyss + yyps_index;
  263. !             yyvsp = yyvs + yypv_index;
  264.                   }
  265.                   *++yyssp = yystate = yytable[yyn];
  266.                   *++yyvsp = yylval;
  267. ***************
  268. *** 1495,1502 ****
  269.               {
  270.   #if YYDEBUG
  271.                   if (yydebug)
  272. !                     printf("yydebug: error recovery discarding state %d\n",
  273. !                             *yyssp);
  274.   #endif
  275.                   if (yyssp <= yyss) goto yyabort;
  276.                   --yyssp;
  277. --- 1507,1515 ----
  278.               {
  279.   #if YYDEBUG
  280.                   if (yydebug)
  281. !                     fprintf(stderr,
  282. !             "yydebug: error recovery discarding state %d\n",
  283. !             *yyssp);
  284.   #endif
  285.                   if (yyssp <= yyss) goto yyabort;
  286.                   --yyssp;
  287. ***************
  288. *** 1513,1520 ****
  289.               yys = 0;
  290.               if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
  291.               if (!yys) yys = "illegal-symbol";
  292. !             printf("yydebug: state %d, error recovery discards token %d (%s)\n",
  293. !                     yystate, yychar, yys);
  294.           }
  295.   #endif
  296.           yychar = (-1);
  297. --- 1526,1534 ----
  298.               yys = 0;
  299.               if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
  300.               if (!yys) yys = "illegal-symbol";
  301. !             fprintf(stderr,
  302. !         "yydebug: state %d, error recovery discards token %d (%s)\n",
  303. !         yystate, yychar, yys);
  304.           }
  305.   #endif
  306.           yychar = (-1);
  307. ***************
  308. *** 1523,1529 ****
  309.   yyreduce:
  310.   #if YYDEBUG
  311.       if (yydebug)
  312. !         printf("yydebug: state %d, reducing by rule %d (%s)\n",
  313.                   yystate, yyn, yyrule[yyn]);
  314.   #endif
  315.       yym = yylen[yyn];
  316. --- 1537,1543 ----
  317.   yyreduce:
  318.   #if YYDEBUG
  319.       if (yydebug)
  320. !         fprintf(stderr, "yydebug: state %d, reducing by rule %d (%s)\n",
  321.                   yystate, yyn, yyrule[yyn]);
  322.   #endif
  323.       yym = yylen[yyn];
  324. ***************
  325. *** 2242,2249 ****
  326.       {
  327.   #if YYDEBUG
  328.           if (yydebug)
  329. !             printf("yydebug: after reduction, shifting from state 0 to\
  330. !  state %d\n", YYFINAL);
  331.   #endif
  332.           yystate = YYFINAL;
  333.           *++yyssp = YYFINAL;
  334. --- 2256,2264 ----
  335.       {
  336.   #if YYDEBUG
  337.           if (yydebug)
  338. !             fprintf(stderr,
  339. !         "yydebug: after reduction, shifting from state 0 to state %d\n",
  340. !         YYFINAL);
  341.   #endif
  342.           yystate = YYFINAL;
  343.           *++yyssp = YYFINAL;
  344. ***************
  345. *** 2257,2263 ****
  346.                   yys = 0;
  347.                   if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
  348.                   if (!yys) yys = "illegal-symbol";
  349. !                 printf("yydebug: state %d, reading %d (%s)\n",
  350.                           YYFINAL, yychar, yys);
  351.               }
  352.   #endif
  353. --- 2272,2278 ----
  354.                   yys = 0;
  355.                   if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
  356.                   if (!yys) yys = "illegal-symbol";
  357. !                 fprintf(stderr, "yydebug: state %d, reading %d (%s)\n",
  358.                           YYFINAL, yychar, yys);
  359.               }
  360.   #endif
  361. ***************
  362. *** 2272,2291 ****
  363.           yystate = yydgoto[yym];
  364.   #if YYDEBUG
  365.       if (yydebug)
  366. !         printf("yydebug: after reduction, shifting from state %d \
  367. ! to state %d\n", *yyssp, yystate);
  368.   #endif
  369.       if (yyssp >= yyss + yystacksize - 1)
  370.       {
  371. !         goto yyoverflow;
  372.       }
  373.       *++yyssp = yystate;
  374.       *++yyvsp = yyval;
  375.       goto yyloop;
  376.   yyoverflow:
  377. !     yyerror("yacc stack overflow");
  378.   yyabort:
  379. !     return (1);
  380.   yyaccept:
  381. !     return (0);
  382.   }
  383. --- 2287,2321 ----
  384.           yystate = yydgoto[yym];
  385.   #if YYDEBUG
  386.       if (yydebug)
  387. !         fprintf(stderr,
  388. !         "yydebug: after reduction, shifting from state %d to state %d\n",
  389. !         *yyssp, yystate);
  390.   #endif
  391.       if (yyssp >= yyss + yystacksize - 1)
  392.       {
  393. !     /*
  394. !     ** reallocate and recover.  Note that pointers
  395. !     ** have to be reset, or bad things will happen
  396. !     */
  397. !     int yyps_index = (yyssp - yyss);
  398. !     int yypv_index = (yyvsp - yyvs);
  399. !     yystacksize += YYSTACKSIZE;
  400. !     ysave->yyvs = yyvs =
  401. !         (YYSTYPE*)realloc((char*)yyvs,yystacksize * sizeof(YYSTYPE));
  402. !     ysave->yyss = yyss =
  403. !         (short*)realloc((char*)yyss,yystacksize * sizeof(short));
  404. !     if (!yyvs || !yyss)
  405. !         goto yyoverflow;
  406. !     yyssp = yyss + yyps_index;
  407. !     yyvsp = yyvs + yypv_index;
  408.       }
  409.       *++yyssp = yystate;
  410.       *++yyvsp = yyval;
  411.       goto yyloop;
  412.   yyoverflow:
  413. !     yyerror("Out of memory for yacc stack");
  414.   yyabort:
  415. !     retval = 1;
  416.   yyaccept:
  417. !     return retval;
  418.   }
  419.